package com.itheima.youdianda.controller;

import com.itheima.youdianda.common.Result;
import com.itheima.youdianda.domain.SysConfig;
import com.itheima.youdianda.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author chensen
 * @create 2022/9/7/14:58
 */
@RestController
@RequestMapping("sys_config")
public class SysConfigController {
    @Autowired
    private SysConfigService sysConfigService;

    @PostMapping("add")
    public Result add(@RequestBody SysConfig sysConfig) {
        sysConfigService.save(sysConfig);
        return Result.ok("添加成功!");
    }

    @GetMapping("all")
    public Result all(){
        Map<String, Object> map = sysConfigService.all();
        return Result.ok(map);
    }
}
